from google.appengine.ext import db
from google.appengine.ext import blobstore
from google.appengine.api import images


class UploadedFiles(db.Model):
    filename = db.StringProperty()
    storagekey = db.StringProperty()

    def storeFile(self, blob):
        self.filename = blob.filename
        self.storagekey = str(blob.key())

class ImagesFromBlob:
    filename = db.StringProperty()
    storagekey = db.StringProperty()
    url = db.StringProperty()


    def __init__(self, filename, key):
        self.filename = filename
        self.storagekey = key
        self.url = images.get_serving_url(self.storagekey, 1000)